home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / progjrn / pj_7_3a.arc / KEYBOARD.CPP < prev    next >
C/C++ Source or Header  |  1989-02-20  |  505b  |  30 lines

  1. // keyboard.cpp    Keyboard class non-inline mehtods.
  2. //
  3. // (c) Aspen Scientific 1989. All Rights Reserved.
  4. // Author: Vaughn Vernon
  5.  
  6. #include "keyboard.cls"
  7.  
  8. #include <dos.h>
  9. #include <conio.h>
  10.  
  11. static union REGS kRegs;
  12.  
  13. int
  14. Keyboard::input(int wait)
  15. {
  16.     if (!wait && !kbhit())
  17.         return (keyI = -1);
  18.  
  19.     kRegs.h.ah = 0;
  20.     int86(0x16, &kRegs, &kRegs);
  21.  
  22.     if (kRegs.h.al != 0)
  23.         keyI = kRegs.h.al;        // regular key
  24.     else
  25.         keyI = kRegs.h.ah | extMask;    // extended key
  26.  
  27.     return keyI;
  28. }
  29.  
  30.